#include <iostream>
#include <unistd.h>
#include <sys/wait.h>
#include "ProcessPool.hpp"

int main()
{
    pid_t pid = fork();
    if (pid == 0)
    {
        ProcessPool pool;
        pool.Create(5);
        int cnt = 5;
        while (cnt--)
        {
            sleep(1);
            pool.Run();
        }
        sleep(10);
        pool.Close();
        exit(0);
    }
    int status;
    waitpid(pid, &status, 0);
    std::cout << "main exit code:" << ((status >> 8) & 0xFF) << " signal code:" << (status & 0x7F) << std::endl;
    
    return 0;
}